package com.twentyOne.ClothingLand.service.impl;

import java.util.List;

import com.twentyOne.ClothingLand.dao.IBarcodeDAO;
import com.twentyOne.ClothingLand.dao.IGoodsDAO;
import com.twentyOne.ClothingLand.dao.ISaleOrderItemDAO;
import com.twentyOne.ClothingLand.dao.impl.BarcodeDAO;
import com.twentyOne.ClothingLand.dao.impl.GoodsDAO;
import com.twentyOne.ClothingLand.dao.impl.SaleOrderItemDAO;
import com.twentyOne.ClothingLand.service.ISaleOrderItemService;
import com.twentyOne.ClothingLand.vo.Barcode;
import com.twentyOne.ClothingLand.vo.Goods;
import com.twentyOne.ClothingLand.vo.SaleOrderItem;

public class SaleOrderItemService implements ISaleOrderItemService {
	
	private ISaleOrderItemDAO saleOrderItemDAO = new SaleOrderItemDAO();
	private IBarcodeDAO barcodeDAO = new BarcodeDAO();
	private IGoodsDAO goodsDAO = new GoodsDAO();
	
	@Override
	public String addSaleOrderItem(SaleOrderItem item) {
		
		this.saleOrderItemDAO.addSaleOrderItem(item);
		return null;
		
	}

	@Override
	public Goods showSelectedItem(String code) {

		Barcode barcode = this.barcodeDAO.searchBarcodeByCode(code);
		Goods goods = this.goodsDAO.searchGoodsByID(barcode.getGoodsId());
		return goods;
		
	}

	@Override
	public List<SaleOrderItem> searchItemBySaleOrderNo(String saleOrderNo) {

		return this.saleOrderItemDAO.searchItemBySaleOrderNo(saleOrderNo);
		
	}

	@Override
	public void modifySaleOrderItem(SaleOrderItem item) {
		
		this.saleOrderItemDAO.modifySaleOrderItem(item);
		
	}

	@Override
	public SaleOrderItem searchItemByNo_Barcode(String saleOrderNo,
			String barcode) {

		return this.saleOrderItemDAO.searchItemByNo_Barcode(saleOrderNo, barcode);
		
	}

	@Override
	public void deleteSaleOrderItem(SaleOrderItem item) {
		
		this.saleOrderItemDAO.deleteSaleOrderItem(item);
		
	}

}
